<template>
  <div
    style="display: flex;
  justify-content: center;
  "
  >
    <el-form
      label-width="120px"
      style="display: flex;
      flex-direction: column;
      "
    >
      <el-form-item label="集群名称">
        <el-input
          v-model="jqForm.clusterName"
          style="width: 190px"
          placeholder="请输入"
          disabled
        />
      </el-form-item>
      <el-form-item label="集群版本">
        <el-select
          v-model="jqForm.clusterVersion"
          placeholder="请选择"
          style="width: 190px"
          disabled
        >
          <el-option
            v-for="val in versionList"
            :key="val"
            :label="val"
            :value="val"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="集群标识">
        <el-input
          v-model="jqForm.clusterFlag"
          style="width: 190px"
          placeholder="请输入"
          disabled
        />
      </el-form-item>
      <el-form-item label="hdfs前缀路径">
        <el-input
          v-model="jqForm.hdfsPrefixPath"
          placeholder="请输入"
          style="width: 320px"
          disabled
        />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import ballsApi from '@/api/dashboard/ballsPanel'
export default {
  data() {
    return {
      jqForm: {},
      versionList: ['CDH 6.3.2 (Parcel)']
    }
  },
  mounted() {
    this.getclustersparingconf()
  },
  methods: {
    getclustersparingconf() {
      var data = {
        current: 1,
        size: 10,
        clusterName: '金桥'
      }
      ballsApi.getclustersparingconf(data)
        .then((data) => {
          console.log('jinqiao')
          console.log(data.records[0])
          this.length = data.total
          this.jqForm = data.records[0]
        })
    },
    InitializationScan() {
      this.$confirm('初始化扫描会导致热备基础配置重置，是否继续', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      })
        .then(() => {
          var data = {
            source: '初始化'
          }
          ballsApi.InitializationScan(data)
            .then((data) => {
              this.$message({
                type: 'success',
                message: '成功!'
              })
            })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          })
        })
    }
  }
}
</script>

<style>
</style>
